<?php

class Soul_Request_Context_Method {
    
    public function __construct(){}

    public function templateResultHelper($filename, $data = array()){
        return Soul_Loader::loadInstance('Soul_Request_Result_Template')
                ->setFile($filename)
                ->addData($data);
    }

    public function redirectResultHelper($url = '*/*/*/*', $urlArgs = NULL){
        $rurl = Soul_Request_Factory::getRouter()->buildUrl($url, $urlArgs);
        return Soul_Loader::loadInstance('Request_Result_Redirect')->setUrl($rurl);
    }

    public function refererResultHelper($url = '*/*/*/*', $urlArgs = NULL){
        $url = isset($_SERVER['HTTP_REFERER'])? 
                $_SERVER['HTTP_REFERER']: 
                $GLOBALS[RC]->getRouter()->buildUrl($url, $urlArgs);
        return Soul_Loader::loadInstance('Request_Result_Redirect')->setUrl($url);
    }
    
    public function contentResultHelper($content){
        return Soul_loader::loadInstance('Request_Result_Content')->setContent($content);
    }

    public function jsonResultHelper(){
        return Soul_loader::loadInstance('Request_Result_Json');
    }    
    
    public function endResultHelper(){
        return new Soul_Request_Result_End();
    }
}